Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add installed_kibana_space_id to epm-packages saved objects #120517

Merged
merged 14 commits into from
Dec 17, 2021

Conversation

hop-dev
Copy link
Contributor

@hop-dev hop-dev commented Dec 6, 2021

Summary

Part of #74353.

Add the installed_kibana_space_id to the epm-packages saved object type, and use this field when removing assets.

This enables us to better handle integrations that have been installed in different spaces, previously if we installed an integration in the default space, then uninstalled it in a different space, the assets would not be deleted.

Manual tests:

  • Install a package in the default space

    • check that the epm-packages saved object has installed_kibana_space_id set to default
    • uninstall the package from a different space
    • check that all assets have been removed.
  • Install a package not in the default space e.g space2

    • check that the epm-packages saved object has installed_kibana_space_id set to space2
    • uninstall the package from a different space e,g default space
    • check that all assets have been removed.

@hop-dev hop-dev changed the title [Fleet] Track installation space ID on epm-packages saved objects [Fleet]Add installed_kibana_space_id to epm-packages saved objects Dec 6, 2021
@hop-dev hop-dev added auto-backport Deprecated - use backport:version if exact versions are needed release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.0.0 v8.1.0 labels Dec 6, 2021
@hop-dev hop-dev force-pushed the 74353-add-space-to-package-so branch 3 times, most recently from 447785b to a134122 Compare December 13, 2021 11:42
@hop-dev hop-dev marked this pull request as ready for review December 13, 2021 17:18
@hop-dev hop-dev requested a review from a team as a code owner December 13, 2021 17:18
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor

I tested with the changes locally, and seems to be working fine. I see the space mentioned in assets.
image

Is that expected that when I add an integration in one space, the assets are only visible in that space, and not when I switch to another space?

@hop-dev hop-dev force-pushed the 74353-add-space-to-package-so branch from e798a83 to 774034f Compare December 14, 2021 13:09
@hop-dev hop-dev requested a review from a team as a code owner December 14, 2021 13:09
@hop-dev hop-dev force-pushed the 74353-add-space-to-package-so branch from 774034f to befbc38 Compare December 14, 2021 14:15
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kbn-test changes LGTM

@hop-dev
Copy link
Contributor Author

hop-dev commented Dec 15, 2021

Is that expected that when I add an integration in one space, the assets are only visible in that space, and not when I switch to another space?

Yes this is expected for now, we will need some further work to display the assets in all spaces.

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great and seems to work as intended. Have a few questions before merging below.

I did retest the case I noticed was broken in #119527 (review) and it now appears to be fixed! ✅

x-pack/plugins/fleet/dev_docs/data_model.md Show resolved Hide resolved
x-pack/plugins/fleet/kibana.json Outdated Show resolved Hide resolved
x-pack/plugins/fleet/server/plugin.ts Outdated Show resolved Hide resolved
x-pack/plugins/fleet/server/services/preconfiguration.ts Outdated Show resolved Hide resolved
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Test Failures

  • [job] [logs] OSS CI Group #9 / management field formatter set and change field formatter can change format more than once

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1154 1156 +2

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/development-plugin-saved-objects.html#_mappings

id before after diff
epm-packages 19 20 +1
Unknown metric groups

API count

id before after diff
fleet 1266 1268 +2

History

  • 💚 Build #13336 succeeded 68abf5eb50cef160bbe01df6b71028d270c75c1d
  • 💚 Build #13123 succeeded befbc38183de00ae4bf670a70cd56a0b3453337e
  • 💔 Build #13106 failed 774034fcfedf1954f0d4db0976a5efe46d9bfac7
  • 💔 Build #12932 failed e798a837cfb50e877fbb9b76e48d6370e2f96cc7
  • 💚 Build #12787 succeeded a13412243dba32db155cfc8a82138f25e1a62b88
  • 💛 Build #11889 was flaky 447785b5212833ffd4f40204ad1c271b136936e1

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @hop-dev

@joshdover joshdover changed the title [Fleet]Add installed_kibana_space_id to epm-packages saved objects [Fleet] Add installed_kibana_space_id to epm-packages saved objects Dec 17, 2021
@joshdover joshdover merged commit a547d4a into elastic:main Dec 17, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
8.0 Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 120517

joshdover pushed a commit to joshdover/kibana that referenced this pull request Dec 17, 2021
…ts (elastic#120517)

# Conflicts:
#	x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts
#	x-pack/plugins/fleet/server/routes/preconfiguration/index.ts
@hop-dev hop-dev deleted the 74353-add-space-to-package-so branch December 17, 2021 18:55
joshdover added a commit that referenced this pull request Dec 20, 2021
… objects (#120517) (#121553)

* [Fleet] Add `installed_kibana_space_id` to `epm-packages` saved objects (#120517)

# Conflicts:
#	x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts
#	x-pack/plugins/fleet/server/routes/preconfiguration/index.ts

* fix handler types

Co-authored-by: Mark Hopkin <mark.hopkin@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants